import { cafReq } from "..";
// import { QueryParams } from "../request";

// export const baseURL =
//   import.meta.env.MODE === "development"
//     ? "/trq"
//     : `${import.meta.env.VITE_REQ_URL}:30011`;
// const secondUrlOld = "/query-services/cost-journal-entry/v1";
const secondUrl = "/query-services/cost-journal-entry/v1";
const secondUrl2 = "/query-services/transaction-type-dict/v1";
export const baseURL = `${import.meta.env.VITE_FIN_URL}`;

export const queryJournalEntry = async (params: any) => {
  return await cafReq(0, { baseURL }).post(
    `${secondUrl}/queryJournalEntry`,
    params
  );
};
export const queryJournalByBusinessId = async (businessId: any, data?: any) => {
  return await cafReq(0, { baseURL }).post(
    `${secondUrl}/queryJournalByBusinessId?businessId=${businessId}`,
    data
  );

  // return await cafReq(0, { baseURL }).post(
  //   `${secondUrl}/queryJournalByBusinessId?businessId=${businessId}`,
  //   data
  // );
};
/**
 * 根据ID查询
 */
export const trAllQuery = async (params: any) => {
  return await cafReq(0, { baseURL }).post(
    `/query-services/cost-transaction-process-req/v1/pageQueryTransactionReq`,
    params
  );
};
/**
 *获取事务类型字典
 *
 */
export const queryTransactionTypeDictData = async () => {
  return await cafReq(0, { baseURL }).get(
    `${secondUrl2}/queryTransactionTypeDictData`
  );
};
export const getExcelAll = async (config: any, data: any) => {
  return await cafReq(1, { needOrigin: true, baseURL }).post(
    `/query-services/cost-transaction-process-req/v1/exportToExcel`,
    data,
    config
  );
};
